package client

import (
	"fmt"
	"github.com/urfave/cli/v2"
	"path"
	"ycontainer/compress"
	"ycontainer/container"
)

func CommitAction(context *cli.Context) error {
	if context.Args().Len() < 1 {
		return fmt.Errorf("missing container name")
	}

	containerName := context.Args().Get(0)
	rootfs := path.Join("/var/lib", container.Ycontainer, "overlay", containerName, "merged")

	return compress.Pack(containerName, rootfs)
}
